package cn.dankal.flyaudio;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;

import api.UserServiceFactory;
import cn.dankal.basiclib.base.activity.BaseWebviewActivity;
import cn.dankal.basiclib.protocol.MainProtocol;
import cn.dankal.basiclib.rx.AbstractDialogSubscriber;
import cn.dankal.basiclib.util.StringUtil;
import cn.dankal.basiclib.util.WebViewUtil;
import cn.dankal.business.pojo.ReasonBean;
import cn.dankal.flyaudio.personal.notificaiton.DataFactory;
import cn.dankal.flyaudio.personal.notificaiton.NotifyPresenter;

@Route(path = MainProtocol.NORMAL_WEBVIEW)
public class NormalWebViewActivity extends BaseWebviewActivity {
    @Autowired(name = "title")
    String title;

    @Autowired(name = "url")
    String url;

    @Autowired(name = "uuid")
    String uuid;


    @Override
    public void initComponents() {
        super.initComponents();
        ARouter.getInstance().inject(this);
        addSingleTitleBar(title);

        if (StringUtil.isValid(url)) {
            WebViewUtil.loadData(wb, url);
        }

        String[] uuids = new String[1];
        uuids[0] = uuid;
        UserServiceFactory.update_remind(DataFactory.getMapData(uuids,0,0 ))
                    .subscribe(new AbstractDialogSubscriber<ReasonBean> (this) {
                        @Override
                        public void onNext(ReasonBean reasonBean) {

                        }
                    });
    }

    @Override
    public String getData() {
        return url;
    }
}
